import { USER_ACTION_TYPE } from './user';
import { PACKAGE_ACTIVITY_PAGE, PACKAGE_MARKET_PAGE } from './route';
import { ACTIVITY_TYPE, ACTIVITY_TYPE_MAP, TARGET_TYPE } from './common';

// 活动菜单类型
export const ACTIVITY_MENU_TYPE = {
    group_buying: ACTIVITY_TYPE.group_buying, // 社区团购
    lottery: ACTIVITY_TYPE.lottery, // 幸运抽奖
    copy: 'copy', // 复制活动
};

// 活动菜单链接
export const ACTIVITY_MENU_ROUTE = {
    [TARGET_TYPE.brand]: {
        [ACTIVITY_MENU_TYPE.group_buying]: PACKAGE_ACTIVITY_PAGE['activityEdit'],
        [ACTIVITY_MENU_TYPE.lottery]: PACKAGE_MARKET_PAGE['lotteryEdit'],
        [ACTIVITY_MENU_TYPE.copy]: PACKAGE_ACTIVITY_PAGE['activityCopyList'],
    },
    [TARGET_TYPE.store]: {
        [ACTIVITY_MENU_TYPE.group_buying]: PACKAGE_ACTIVITY_PAGE['storeActivityEdit'],
        [ACTIVITY_MENU_TYPE.copy]: PACKAGE_ACTIVITY_PAGE['storeActivityCopyList'],
    },
};

// 活动菜单
export const ACTIVITY_MENU_LIST = [{
    name: ACTIVITY_TYPE_MAP[ACTIVITY_TYPE.group_buying].name,
    desc: '将好物推荐给身边的人',
    icon: ACTIVITY_TYPE_MAP[ACTIVITY_TYPE.group_buying].icon,
    iconBackgroundColor: ACTIVITY_TYPE_MAP[ACTIVITY_TYPE.group_buying].backgroundColor,
    iconColor: ACTIVITY_TYPE_MAP[ACTIVITY_TYPE.group_buying].color,
    type: ACTIVITY_MENU_TYPE.group_buying,
    roleList: [TARGET_TYPE.brand, TARGET_TYPE.store],
}, {
    name: '幸运抽奖',
    desc: '活跃社群气氛，增加粘性',
    icon: ACTIVITY_TYPE_MAP[ACTIVITY_TYPE.lottery].icon,
    iconBackgroundColor: ACTIVITY_TYPE_MAP[ACTIVITY_TYPE.lottery].backgroundColor,
    iconColor: ACTIVITY_TYPE_MAP[ACTIVITY_TYPE.lottery].color,
    type: ACTIVITY_MENU_TYPE.lottery,
    roleList: [TARGET_TYPE.brand],
}, {
    name: '复制活动',
    desc: '复制已有活动，快速创建活动',
    icon: 'copy',
    iconBackgroundColor: 'rgba(255, 170, 53, 0.12)',
    iconColor: 'rgba(255, 170, 53, 1)',
    type: ACTIVITY_MENU_TYPE.copy,
    roleList: [TARGET_TYPE.brand, TARGET_TYPE.store],
}];

// 活动拥有者值
export const ACTIVITY_OWNER_VALUE = {
    brand: TARGET_TYPE.brand,
    store: TARGET_TYPE.store,
    spokesman: TARGET_TYPE.spokesman,
};

// 活动状态值
export const ACTIVITY_STATUS_VALUE = {
    all: 'all',
    draft: 'draft',
    starting: 'starting',
    processing: 'processing',
    paused: 'paused',
    finished: 'finished',
    closed: 'closed',
};

// 活动状态名
export const ACTIVITY_STATUS = {
    [ACTIVITY_STATUS_VALUE.all]: '全部',
    [ACTIVITY_STATUS_VALUE.draft]: '待发布',
    [ACTIVITY_STATUS_VALUE.starting]: '未开始',
    [ACTIVITY_STATUS_VALUE.processing]: '进行中',
    [ACTIVITY_STATUS_VALUE.paused]: '暂停中',
    [ACTIVITY_STATUS_VALUE.finished]: '已结束',
    [ACTIVITY_STATUS_VALUE.closed]: '已结束',
};

// 活动列表分组
export const ACTIVITY_LIST_TABS = [{
    value: 'all',
    name: ACTIVITY_STATUS_VALUE.all,
    title: '全部',
}, {
    value: ACTIVITY_STATUS_VALUE.draft,
    name: ACTIVITY_STATUS_VALUE.draft,
    title: '待发布',
}, {
    value: ACTIVITY_STATUS_VALUE.processing,
    name: ACTIVITY_STATUS_VALUE.processing,
    title: '进行中',
}, {
    value: ACTIVITY_STATUS_VALUE.paused,
    name: ACTIVITY_STATUS_VALUE.paused,
    title: '暂停中',
}, {
    value: `${ACTIVITY_STATUS_VALUE.finished},${ACTIVITY_STATUS_VALUE.closed}`,
    name: ACTIVITY_STATUS_VALUE.finished,
    title: '已结束',
}];

// 售卖形式值
export const SALES_TYPE_VALUE = {
    no_limit: 'no_limit',
    only_brand_selling: 'only_brand_selling',
    only_store_selling: 'only_store_selling',
    only_spokesman_consignment: 'only_spokesman_consignment',
};

// 配送方式
export const DELIVERY_TYPE_VALUE = {
    express: 'express',
    self_pickup : 'self_pickup',
    none: 'none',
};

export const DELIVERY_TYPE = {
    [DELIVERY_TYPE_VALUE.express]: '商家配送',
    [DELIVERY_TYPE_VALUE.self_pickup] : '顾客自提',
    [DELIVERY_TYPE_VALUE.none]: '无需配送',
};

// 参与次数
export const FREQUENCY_TYPE = {
    0: '不限制',
    1: '1次',
    2: '2次',
    3: '3次',
    4: '4次',
};

// 活动描述类型
export const ACTIVITY_INTRO_TYPE_VALUE = {
    pic: 'pic',
    pic_list: 'pic_list',
    video: 'video',
    text: 'text',
};
export const ACTIVITY_INTRO_TYPE = {
    [ACTIVITY_INTRO_TYPE_VALUE.pic]: '大图',
    [ACTIVITY_INTRO_TYPE_VALUE.pic_list]: '小图',
    [ACTIVITY_INTRO_TYPE_VALUE.video]: '视频',
    [ACTIVITY_INTRO_TYPE_VALUE.text]: '文字',
};

// 活动操作类型
export const ACTIVITY_USER_ROLE = {
    normal: 'normal', // 普通用户
    user: 'user', // 代言人
    owner: 'owner', // 创建者
};

// 活动操作
export const ACTIVITY_ACTION = {
    [ACTIVITY_USER_ROLE.normal]: [
        { name: '取消关注', action: USER_ACTION_TYPE.cancelFollowActivity },
    ],
    [ACTIVITY_USER_ROLE.user]: [
        { name: '分享活动', action: USER_ACTION_TYPE.shareActivity, openType: 'share' },
    ],
    [ACTIVITY_USER_ROLE.owner]: [
        { name: '分享活动', action: USER_ACTION_TYPE.shareActivity, openType: 'share' },
        { name: '帮卖管理', action: USER_ACTION_TYPE.statsConsignmentActivity },
        { name: '修改活动', action: USER_ACTION_TYPE.changeActivity },
        { name: '启用/停用活动', action: USER_ACTION_TYPE.overOrOpenActivity },
        { name: '复制活动', action: USER_ACTION_TYPE.copyActivity },
        // { name: '删除活动', action: USER_ACTION_TYPE.deleteActivity, color: '#ee0a24' },
    ],
};

// 活动最大商品数
export const ACTIVITY_PRODUCT_MAX = 20;

// 佣金最大比例
export const ACTIVITY_BONUS_RATE = 29.4;
